all: tffs

.PHONY: all

CC=gcc
SHARED_FLAGS=-Wall \
	     -Werror \
	     -g \
	     -D_FILE_OFFSET_BITS=64 \
	     -DFUSE_USE_VERSION=26

CFLAGS=-std=gnu99 \
       $(SHARED_FLAGS)
CXXFLAGS=$(SHARED_FLAGS)
LDFLAGS=-lfuse \
	-lglog

%.o: %.c .deps/%.d
	$(CC) $(CFLAGS) -c -o $@ $<

%.o: %.cc .deps/%.d
	$(CXX) $(CXXFLAGS) -c -o $@ $<

.deps/%.d: %.c
	$(CC) $(CFLAGS) -MM $< -MF $@

.deps/%.d: %.cc
	$(CXX) $(CXXFLAGS) -MM $< -MF $@

OBJECTS=main.o fuse_entrypoints.o real_fs_operations.o block_operations.o fletcher32.o

tffs: $(OBJECTS)
	$(CXX) $(LDFLAGS) $^ -o $@

-include $(OBJECTS:%.o=.deps/%.d)
-include $(LOBJECTS:%.o=.deps/%.d)

clean:
	rm -rf tffs *.o
